﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Code.Models;
using Code.BLL;
using RuiJing.Web.Models.SharedModels;

namespace RuiJing.Web.Controllers
{
    public class SharedController : ControllerBase
    {
        public ActionResult Header(Language l)
        {
            return View("Header_" + l);
        }

        public ActionResult Photo(Language l)
        {
            var model = (CommenManage.Options.First(p => p.Value.Key == "Site_Home_IndexImgs_" + l).Value.Value ?? "").Split(new string[] { "\r\n","§＆§" }, StringSplitOptions.RemoveEmptyEntries);
            return View(model);
        }

        public ActionResult SideBar(Language l)
        {
            var model = new SideBarModel();
            model.Types = (CommenManage.ProductTypes.Where(p => p.ParentID == null)).AsQueryable().Select("new (ID,Name_" + l + " AS Name)").Convert<ProductTypeItem>();
            
            return View(model);
        }

        public ActionResult Footer(Language l)
        {

            return View();
        }

    }
}
